/**
 * @Description: test
 * @Author: Hu Outstanding
 * @Date: 2021/12/30 11:11
 */
package com.aaa.three.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class PermissionUtil {
    public static List<Map<Object,Object>> haha (List<Map<Object,Object>> hehe){
        List<Map<Object,Object>> objects = new ArrayList<>();

        for (Map<Object, Object> objectObjectMap : hehe) {
            if (objectObjectMap.get("type").equals("M")){
                List<Map<Object,Object>> subMenu = new ArrayList<>();
                objectObjectMap.put("subMenu",subMenu);
                objects.add(objectObjectMap);
            }
        }
        for (Map<Object, Object> objectObjectMap : hehe) {
            for (Map<Object, Object> object : objects) {
                if(objectObjectMap.get("pid").equals(object.get("id"))){
                    ((List)object.get("subMenu")).add(objectObjectMap);
                }
            }
        }
        return objects;
    }




}
